import axios from 'axios';

const request = axios.create({
    timeout: 3000
});

request.interceptors.request.use(config => {
    const token = localStorage.getItem('token')

    if(token) {
        config.headers.Authorization = token;
    }

    return config
})


request.interceptors.response.use((config) => {
    return config.data
}, (err) => {
    return Promise.reject(err)
})

export default request